/**
 * ReportGear(2011)
 */
package com.reportgear.core.swing.util;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;

/**
 * Swing实用类
 * 
 * @version 1.0 2011-4-12
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class SwingUtils {
	/**
	 * 设子窗体居中显示
	 * 
	 * @param window
	 *            窗体
	 */
	public static void centerWindow(Window window) {
		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension screenSize = kit.getScreenSize();

		window.setLocation((screenSize.width - window.getWidth()) / 2, (screenSize.height - window.getHeight()) / 2);
	}
}
